<!DOCTYPE html>
<html lang="en">

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
		<title>大学生活-留言板</title>
		<link rel="stylesheet" href="../res/layui/css/layui.css">
		<link rel="stylesheet" href="../res/static/css/index.css">
	</head>

	<body>
		<!-- nav部分 -->
		<div class="nav">
			<div class="layui-container">
				<!-- logo -->
				<div class="nav-logo">
					<a href="index.html">
						<img src="../res/static/img/logo.png" style="width: 200px" height="80px" alt="类友网络">
					</a>
				</div>
				<div class="nav-list">
					<button>
          <span></span><span></span><span></span>
        </button>
					<ul class="layui-nav" lay-filter="">
						<li class="layui-nav-item">
							<a href="index.html">首页</a>
						</li>
						<li class="layui-nav-item">
							<a href="grjs.html">个人介绍</a>
						</li>
						<li class="layui-nav-item">
							<a href="kysh.html">课余生活</a>
						</li>
						<li class="layui-nav-item">
							<a href="xx.html">学校</a>
						</li>
						<li class="layui-nav-item">
							<a href="zygh.html">职业规划</a>
						</li>
						<li class="layui-nav-item layui-this">
							<a href="lyb.html">留言板</a>
						</li>
					</ul>
				</div>
			</div>
		</div>
		<!-- banner部分 -->
		<div class="banner lyb">
			<div class="title">
				<p>留言板</p>
				<p class="en">About Us</p>
			</div>
		</div>
		<!-- main部分 -->
		<div class="lyb1">
		<textarea id="memo" cols="60" rows="10"></textarea>
		<input type="button" value="追加内容" onclick="saveStorage('memo')" />
		<input type="button" value="初始化" onclick="clearStorage('msg')" />
		<hr />
		<p id="msg"></p>
		<script type="text/javascript">
			function saveStorage(id) {
				//获取textarea的value值
				var data = document.getElementById(id).value;
				//获取当前时间戳
				var time = new Date().getTime();
				//将时间戳作为键值，textarea的value值作为键值的内容保存在本地数据库
				localStorage.setItem(time, data);
				//保存成功后提示成功
				console.log("数据已保存");
				//设置loadStorage函数的传参（ID值）
				loadStorage('msg');
			}

			function loadStorage(id) {
				var result = '<table border="1">';
				//遍历本地数据所有内容
				for(var i = 0; i < localStorage.length; i++) {
					//获取每一条新增的键值
					var kes = localStorage.key(i);
					//获取新增键值的内容
					var value = localStorage.getItem(kes);
					//获取时间对象
					var date = new Date();
					//将时间戳转化为正常时间 Mon Jun 19 1972 11:12:44 GMT+0800 (中国标准时间) 的格式
					date.setTime(kes);
					//将转化后的内容变成字符串
					var datestr = date.toGMTString();
					//将所有新增内容添加到result变量中
					result += '<tr><td>' + value + '</td><td>' + datestr + '</td></tr>'
				}
				result += '</table>';
				var target = document.getElementById(id);
				//将所有内容添加到元素中显示
				target.innerHTML = result;

			}

			function clearStorage() {
				//清除本地储存所有内容
				localStorage.clear();
				console.log("清除完毕");
			}
		</script>
		</div>
		<div class="footer">
			<div class="layui-container">
				<p class="footer-web">
					<a href="http://www.ccyl.org.cn/">共青团中央</a>
					<a href="http://www.ccyl.org.cn/organs/institution/xxb/">团中央学校部</a>
					<a href="http://www.gdcyl.org/Index.html">广东共青团</a>
					<a href="http://www.gdcyl.org/xxb/">广东学联</a>
					<a href="http://www.qygqt.org/">清远共青团</a>
					<a href="http://www.qypt.com.cn/">清远职业技术学院</a>
				</p>
				<div class="layui-row footer-contact">
					<div class="layui-col-sm2 layui-col-lg1"><img src="../res/static/img/erweima.png"></div>
					<div class="layui-col-sm10 layui-col-lg11">
						<div class="layui-row">
							<div class="layui-col-sm6 layui-col-md8 layui-col-lg9">
								<p class="contact-top">本站部分文章、资源来自互联网，版权归原作者及网站所有</p>
								<p class="contact-bottom">如果侵犯了您的权利，请及时致信告知我站</p>
							</div>
							<div class="layui-col-sm6 layui-col-md4 layui-col-lg3">
								<p class="contact-top"><span class="right">广东省清远市清城区蟠龙园</span></p>
								<p class="contact-bottom"><span class="right">Copyright&nbsp;©&nbsp;2018-2020 更多模板：<a href="http://www.mycodes.net/" target="_blank">源码之家</a></span></p>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<script src="../res/layui/layui.js"></script>
		<!--[if lt IE 9]>
  <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
		<script>
			layui.config({
				base: '../res/static/js/'
			}).use('firm');
		</script>
	</body>

</html>